<template>
	<view>
		<view class="edgeInsetTop"></view>
		<form @submit="formSubmit">
			<view class="cu-list menu solid-bottom">
				<view class="cu-item arrow" style="min-height:150rpx;">
					<view class="content">
						<text style="font-size: 30rpx;">门店头像</text>
					</view>
					<view class="action">
						<view class="cu-avatar round lg" :style="{backgroundImage: 'url('+ $wanlshop.oss(user.myshop.avator, 52, 52, 2, 'avatar') +')'}" ></view>
					</view>
				</view>
			</view>
			<view class="cu-form-group">
				<view class="title">店铺名称</view>
				<input placeholder="请输入店铺名称" name="shopname" :value="user.myshop.shopname"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">店铺关健字</view>
				<input placeholder="请输入店铺关健字" name="keywords" :value="user.myshop.keywords"></input>
			</view>			
			
			<view class="cu-form-group">
				<view class="title">店铺介绍</view>
				<input placeholder="请输入门介绍" name="description" :value="user.myshop.description"></input>
			</view>

			<view class="padding-bj flex flex-direction">
				<button form-type="submit" class="cu-btn wanl-bg-redorange margin-tb lg">保存</button>				
			</view>	
			
		</form>
           
	</view>
</template>

<script>
	import graceChecker from '@/common/graceChecker';
	import { mapState } from 'vuex';
	export default {
		computed: {
			...mapState(['user'])
		},
		data() {
			return {
				
			}
		},
		onLoad() {
			
		},
		methods: {
			
			formSubmit: function(e) {
				//定义表单规则	
				
				//进行表单检查
				let formData = e.detail.value;				
				
				// ..检查是否注册-没注册跳转注册
				if (checkRes) {
					uni.request({
						url: '/wanlshop/user/partneredit', 
						method: 'POST',
						data: formData,
						success: res => {
							// 保存用户信息
							this.$store.commit('user/setUserInfo', {myshop: data.data});
							// 提示
							this.$wanlshop.msg('保存成功');
						}
					});
				} else {
					this.$wanlshop.msg(graceChecker.error);
				}
			}
		}
	}
</script>

<style>
	.cu-form-group .title {
		min-width: calc(4em + 15px);
	}
</style>
